package com.c5p1ng.cloudmall.coupon.feign.impl;

import com.c5p1ng.cloudmall.coupon.entity.CouponHistoryEntity;
import com.c5p1ng.cloudmall.coupon.feign.CouponFeignService;
import com.c5p1ng.cloudmall.coupon.service.CouponHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class CouponFeignServiceImpl implements CouponFeignService {
    @Autowired
    private CouponHistoryService couponHistoryService;

    @Override
    public List<CouponHistoryEntity> getMemberCoupons(Long memberId) {
        Map<String, Object> map = new HashMap<>();
        map.put("member_id", memberId);
        List<CouponHistoryEntity> list = (List<CouponHistoryEntity>) couponHistoryService.listByMap(map);
        return list;
    }
}
